/* eslint-disable eqeqeq *///忽略==的警告
import { getRemoteDataList } from '../utils/deviceUtils';
import { meshLog, SPRemove, SPGet, SPSet } from '../config';
//重新写的方法
//传入一个值，返会是00还是01
export const getGrouplghtONOFF = (groupStatus) => {
    let isOnoff = groupStatus.slice(0, 2)
    return isOnoff
}
//获取到当前groupId下的所有的灯
export const getlghtbygroupId = (groupId) => {
    const nodes = JSON.parse(SPGet("nodes"))
    let deviceSet = nodes.filter((item) => {
        //if (item.groupID == groupId && item.isProvisioned == true) {
        if (item.groupID == groupId) {
            return item
        }
    })

    // meshLog('groupId111', groupId);
    return deviceSet
}

// //保存localStorage上的GROUP的修改信息的
export const saveGroupInfor = (groupInfo) => {
    //meshLog("修改参数:", areaItem);
    let groupList = JSON.parse(SPGet("groupList"));
    const daylightModel = groupInfo.daylightModel
    const motionModel = groupInfo.motionModel
    for (let i = 0; i < groupList.length; i++) {
        if (groupList[i].groupID == groupInfo.groupID) {
            groupList[i].isOnOff = groupInfo.isOnOff;
            groupList[i].cctLevel = groupInfo.cctLevel;
            groupList[i].dimLevel = groupInfo.dimLevel;
            groupList[i].detectionArea = motionModel.detectionSensitivity;
            groupList[i].motionSensorEnabled = motionModel.isEnabled;
            groupList[i].holdTime = motionModel.holdTime;
            groupList[i].maxLight = motionModel.maxLight;
            groupList[i].standbyPeriod = motionModel.standbyPeriod;
            groupList[i].standbyDim = motionModel.standbyDimLevel;
            groupList[i].daylightSensor = daylightModel.isEnabled;
            groupList[i].daylightThreshold = daylightModel.threshold;
            groupList[i].dhEnabled = daylightModel.isDaylightHarvesting

        }
    }
    //meshLog('groupList', groupList);
    SPRemove('groupList');//删除loaclstorage上的areaSetx
    SPSet('groupList', JSON.stringify(groupList))
    // meshLog("areaSetx:", areaSetx);
    return groupList
}


//上面是修改过的

// //传入一个pid返回一个图标对应的标志位
// export const getPidImage = (pid) => {
//     let pidpandun
//     if (pid == "1001") {
//         pidpandun = '1001'
//     } else if (pid == "1002") {
//         pidpandun = '1002'
//     } else if (pid == "1003") {
//         pidpandun = '1003'
//     } else if (pid == "1004") {
//         pidpandun = '1004'
//     } else {
//         pidpandun = '1005'
//     }
//     // meshLog('groupId111', groupId);
//     return pidpandun
// }

// //取前22字节的加起来的总额和，并且返回后两位
// export const stringTo16 = (value) => {
//     let logo1 =
//         parseInt(value.slice(9, 10), 16) +
//         parseInt(value.slice(10, 12), 16) +
//         parseInt(value.slice(12, 14), 16) +
//         parseInt(value.slice(14, 16), 16) +
//         parseInt(value.slice(16, 18), 16) +
//         parseInt(value.slice(18, 20), 16) +
//         parseInt(value.slice(20, 22), 16) +
//         parseInt(value.slice(22, 24), 16) +
//         parseInt(value.slice(24, 26), 16) +
//         parseInt(value.slice(26, 28), 16) +
//         parseInt(value.slice(28, 30), 16) +
//         parseInt(value.slice(30, 32), 16) +
//         parseInt(value.slice(32, 34), 16) +
//         parseInt(value.slice(34, 36), 16) +
//         parseInt(value.slice(36, 38), 16) +
//         parseInt(value.slice(38, 40), 16) +
//         parseInt(value.slice(40, 42), 16) +
//         parseInt(value.slice(42, 44), 16) +
//         parseInt(value.slice(44, 46), 16) +
//         parseInt(value.slice(46, 48), 16) +
//         parseInt(value.slice(48, 50), 16) +
//         parseInt(value.slice(50, 52), 16)
//     const result = logo1.toString(16).slice(-2);
//     return result
// }


// //修改状态中所有的组的的信息 有返回值 主要是针对开关灯的状态更新
// export const saveStateAreaSetInfor = (areaSet, value, areaNo) => {
//     for (let i = 0; i < areaSet.length; i++) {
//         if (areaSet[i].areaNo === areaNo) {
//             areaSet[i].isOnoff = value;
//         }
//     }
//     //meshLog("areasetDevs:", areasetDevs);
//     return areaSet
// }
// //修改状态中所有的组的的信息 有返回值 主要是针对tem的状态更新
// export const saveStateAreaTemInfor = (value, areaNo) => {
//     let areaSet = JSON.parse(SPGet("areaSetx"))
//     // meshLog('homeUtils.jsx,129行,areaNo', areaNo);
//     for (let i = 0; i < areaSet.length; i++) {
//         if (areaSet[i].areaNo === areaNo) {
//             areaSet[i].tem = value;
//         }
//     }
//     // meshLog("areasetDevs:", areaSet);
//     SPRemove('areaSetx');
//     SPSet('areaSetx', JSON.stringify(areaSet))//存到localStorage
//     return areaSet
// }
